package Code.Day3_20240920.com.dx.day03;

import java.util.Arrays;

/**
 * @ClassName Test02
 * @Description 二维数组
 * @Author 12994
 * @Date 2024/9/20 11:26
 * @Version 1.0
 **/
public class Test02 {
    public static void main(String[] args) {
        double[][] score = {{1, 1, 1, 1, 1}, {2, 2, 2, 2, 2}, {3, 3, 3, 3, 3}, {4, 4, 4, 4, 4}, {5, 5, 5, 5, 5}};

        for (int i = 0; i < score.length; i++) {
            double sum = 0;
            for (int j = 0; j < score[i].length; j++) {
                sum += score[i][j];
            }
            System.out.println(Arrays.stream(score[i]).average().getAsDouble());
            System.out.printf("%d班的平均分是: %.2f\n", i + 1, sum / score[i].length);
        }
    }
}
